package cn.dansj.entity;

import cn.dansj.bean.TableConstant;
import cn.dansj.enums.GlobalEnv;
import cn.dansj.common.utils.transfer.DefaultMethods;
import cn.dansj.common.utils.transfer.Transformation;
import cn.dansj.common.utils.transfer.Verification;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

import java.io.Serial;
import java.io.Serializable;
import java.sql.Timestamp;

@Entity
@Table(name = TableConstant.interfaceInfo)
public class InterfaceInfo extends DefaultMethods implements Serializable {
    @Serial
    private static final long serialVersionUID = GlobalEnv.SerialVersionUID;
    @Id
    private String sequence;
    private String interfaceName;
    private String params;
    private String code;
    private String comments;
    private String method;
    private String type;
    private int apiType;
    private String returnType;
    private int encrypt;
    private String url;
    private String inGroup;
    private int status;
    private String response;
    private int checkPermission;
    private int requestLock;
    private int useCache;
    private String whiteList;
    private String blackList;
    private Timestamp crtTime;
    private Timestamp updateTime;

    public String getSequence() {
        return sequence;
    }

    public void setSequence(String sequence) {
        this.sequence = sequence;
    }

    public String getInterfaceName() {
        return interfaceName;
    }

    public void setInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = Verification.checkNotNull(code) ? code.trim() : "";
    }

    public Timestamp getCrtTime() {
        return crtTime;
    }

    public void setCrtTime(Timestamp crtTime) {
        this.crtTime = crtTime;
    }

    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public long getVersion() {
        return updateTime == null ? 0 : updateTime.getTime();
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    public String getParams() {
        return params;
    }

    public void setParams(String params) {
        this.params = params;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getReturnType() {
        return Transformation.nvl(returnType, "list");
    }

    public void setReturnType(String returnType) {
        this.returnType = returnType;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getApiType() {
        return apiType;
    }

    public void setApiType(int apiType) {
        this.apiType = apiType;
    }

    public int getCheckPermission() {
        return checkPermission;
    }

    public void setCheckPermission(int checkPermission) {
        this.checkPermission = checkPermission;
    }

    public int getRequestLock() {
        return requestLock;
    }

    public void setRequestLock(int requestLock) {
        this.requestLock = requestLock;
    }

    public int getUseCache() {
        return useCache;
    }

    public void setUseCache(int useCache) {
        this.useCache = useCache;
    }

    public String getResponse() {
        return response;
    }

    public void setResponse(String response) {
        this.response = response;
    }

    public int getEncrypt() {
        return encrypt;
    }

    public void setEncrypt(int encrypt) {
        this.encrypt = encrypt;
    }

    public String getInGroup() {
        return inGroup;
    }

    public void setInGroup(String inGroup) {
        this.inGroup = inGroup;
    }

    public String getWhiteList() {
        return whiteList;
    }

    public void setWhiteList(String whiteList) {
        this.whiteList = whiteList;
    }

    public String getBlackList() {
        return blackList;
    }

    public void setBlackList(String blackList) {
        this.blackList = blackList;
    }
}
